ci: Enable ruff rules to enforce snake_case method naming.#140
Conversation
There was a problem hiding this comment.
Pull request overview
Enables a Ruff naming rule to prevent reintroducing CamelCase/mixed-case function and method names across the repository now that the driver API migration is complete.
Changes:
- Enable Ruff
N802inpyproject.toml. - Add targeted
# noqa: N802suppressions for LIS2MDL methods whereuTuses an uppercase unit symbol. - Rename an SSD1327 example helper from
drawCube()todraw_cube().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pyproject.toml | Turns on Ruff N802 to flag mixed-case function/method names. |
| lib/lis2mdl/lis2mdl/device.py | Suppresses N802 for µT-related APIs that intentionally include an uppercase T. |
| lib/ssd1327/examples/rotating_3d_cube.py | Renames an example function to avoid mixed-case naming. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8f773a6 to
a924f26
Compare
a924f26 to
5f99e8a
Compare
There was a problem hiding this comment.
Pull request overview
This PR tightens the repository’s Python linting by enabling Ruff naming rules to prevent camelCase-style regressions and enforce lowercase naming conventions, along with disallowing print() in non-example production code.
Changes:
- Enable Ruff rules N802/N803/N806 and T20, with per-file ignores for examples and tests where appropriate.
- Rename local variables in a few drivers to comply with the new naming rules (keeping public API/dict keys stable where needed).
- Update one example script to use a snake_case function name.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Enables new Ruff rules and adds per-file ignores for examples/tests. |
| lib/lis2mdl/lis2mdl/device.py | Renames locals to satisfy naming rules; adds targeted noqa where API names intentionally contain uT. |
| lib/wsen-hids/wsen_hids/device.py | Renames local calibration variables to lowercase (dict keys unchanged). |
| lib/hts221/hts221/device.py | Renames local variables in _read_reg16 to lowercase. |
| lib/bq27441/bq27441/device.py | Adds targeted noqa for a parameter name kept for API compatibility. |
| lib/ssd1327/examples/rotating_3d_cube.py | Renames drawCube() to draw_cube() to comply with naming rules. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 0.0.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Closes #135
Summary
Enable 4 ruff naming rules to prevent camelCase regressions and enforce project conventions:
print()in production code (examples excluded)Fixes to pass the new rules
pyproject.tomlselect; exclude examples from T20+N806lib/lis2mdl/device.pyuT→mag_ut,T→temp,NORMALIZATION_THRESHOLD→norm_threshold,Xh/Yh→xh/yh;# noqa: N802onread_magnet_uT()/magnitude_uT()lib/wsen-hids/device.pyt0_degC→t0_degc,t1_degC→t1_degc(local variables only, dict keys unchanged)lib/hts221/device.pylowerByte→lo,higherByte→hilib/bq27441/device.py# noqa: N803oncapacity_mAhparameterlib/ssd1327/examples/rotating_3d_cube.pydrawCube()→draw_cube()Test plan